<script setup lang="ts">
import { } from "vue";
import { QTd, QItem, QItemSection, QItemLabel } from "quasar";

import { ExtIdTuple, Creatable } from "qqlx-core";
import { getTime, getTimeAgo } from "qqlx-cdk";

import { ComAvatar } from "../ComAvatar";

const vueProps = defineProps<{
  entity: Creatable & Pick<ExtIdTuple, "timeCreate">;
}>();
</script>

<template>
  <q-td>
    <q-item dense class="px-0 pr-2 py-0.5">
      <q-item-section avatar class="pr-0 min-w-10">
        <ComAvatar :user="vueProps.entity.justCreator" :size="30" label-pre="开单人：" />
      </q-item-section>
      <q-item-section class="text-caption text-secondary">
        <q-item-label>{{ getTime(Number(vueProps.entity.timeCreate)).text_full }}</q-item-label>
        <q-item-label>创建于 {{ getTimeAgo(Number(vueProps.entity.timeCreate)) }}</q-item-label>
      </q-item-section>
    </q-item>
  </q-td>
</template>
